﻿using ComboBoxExpand;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ComboBoxTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            test();
        }

        public enum testEnum
        {
            [ShowInCombobox("啊啊啊啊")]
            aaa,
            [ShowInCombobox("巴巴爸爸")]
            bbb,
            [ShowInCombobox("纯纯粹粹")]
            ccc,
            [ShowInCombobox("点点滴滴")]
            ddd,
            eee,
        }

        public void test()
        {
            List<TestClazz> temp = new List<TestClazz>();
            TestClazz item = new TestClazz();
            item.Name = "中文";
            item.EnName = "英文";
            item.ListArg = new List<string>() { "aaa" };
            item.Num = 1;
            item.Items = new List<TestItem>();
            item.Items.Add(new TestItem() { Name = "小类", EnName = "item" });
            item.SingleItem = new TestItem() { Name = "小类", EnName = "item" };
            temp.Add(item);

            List<List<TestClazz>> superTemp = new List<List<TestClazz>>();
            stComboBox1.EidtItems(superTemp);
            
            #region 测试
            //stComboBox1.EidtItems(temp, StComboBox.DataInsertType.Add);
            //stComboBox1.EidtItems(enum);
            //stComboBox1.EidtItems(item);
            // stComboBox1.EidtItems(new int[] { 1,2,3});
            //stComboBox1.EidtItems(new double[] { 1,2,3});
            // stComboBox1.EidtItems(new string[] { "1","2","3"});
            //stComboBox1.EidtItems(new char[] { '1', '2', '3' });
            //stComboBox1.EidtItems(new dynamic[] { "a","b" });
            // stComboBox1.EidtItems(temp.ToArray());
            //stComboBox1.EidtItems(new ArrayList() { "aa","bbb"});
            //List<object> tempdata = new List<object>();
            //tempdata.Add("aaa");
            //stComboBox1.EidtItems(temp);
            //var dic = new Dictionary<string, string>();
            //dic.Add("aaa", "bbb");
            //dic.Add("ccc", "ddd");

            //stComboBox1.EditItemsForDictionary(dic,false); 
            #endregion
        }

        private void button1_Click(object sender, EventArgs e)
        {
            List<TestClazz> temp = new List<TestClazz>();
            TestClazz item = new TestClazz();
            item.Name = "中文";
            item.EnName = "英文";
            item.ListArg = new List<string>() { "aaa" };
            item.Num = 1;
            item.Items = new List<TestItem>();
            item.Items.Add(new TestItem() { Name = "小类", EnName = "item" });
            item.SingleItem = new TestItem() { Name = "小类", EnName = "item" };
            temp.Add(item);
            this.stComboBox1.EidtItems(temp, StComboBox.DataInsertType.Delete);

        }
    }
}
